using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ByHand.Model
{
    public class Order
    {
        public int ID { get; set; }
        public int? GuuID { get; set; }
        public int ProductID { get; set; }
        public int Quantity { get; set; }
        public DateTime BoughtDate { get; set; }
        public int Price { get; set; }
        public String Buyer { get; set; }
        public DateTime CreatedDate { get; set; }
        public DateTime ModifiedDate { get; set; }
        public String UserCreated { get; set; }
        public String UserModified { get; set; }
        public String ToName { get; set; }
        public String ToAddress { get; set; }
        public String ToPhone { get; set; }
        public String ToEmail { get; set; }
        public int ToCityID { get; set; }
        public int ToDistrictID { get; set; }
        public int? PayType { get; set; }
        public int? Status { get; set; }
        public int? RefID { get; set; }
        private string refLocation;
        public String RefLocation
        {
            get { return refLocation; }
            set
            {
                refLocation = value;
                var domain = value;
                if (!string.IsNullOrWhiteSpace(value))
                {
                    try
                    {
                        domain = new Uri(value).Host;
                    }
                    catch (Exception)
                    {

                        domain = "";
                    }
                }
                RefDomain = domain;
            }
        }
        public int? UserID { get; set; }
        public bool HasProblem { get; set; }
        public String CustomerNote { get; set; }
        public bool? IsSmsSended { set; get; }
        public string RefDomain { get;private set; }

        public Product Product { set; get; }
        public City ToCity { set; get; }
        public District ToDistrict { set; get; }
        public List<OrderDetail> OrderDetail { set; get; }
    }
}
